package com.power.flowable.model;




import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  流程表单发布模型json实体类
*/

@Entity
@ApiModel(value="流程表单发布模型json")
@Data
@Table(name="Act_dsn_form_model")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Act_dsn_form_model.Act_dsn_form_modelPK.class) 用于复合组件
public class Act_dsn_form_model extends BaseModel implements Serializable {

	private static final long serialVersionUID = 1L;

    @Id
    @Setter(AccessLevel.NONE)
    private String id;

    @ApiModelProperty(value = "引用表单id")
    private String formid_;

    @ApiModelProperty(value = "模型key")
    private String key_;

    @ApiModelProperty(value = "发布时间")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date publishtime;

    @ApiModelProperty(value = "流程模型字节流")
    @Lob
    @Basic(fetch = FetchType.LAZY)
    @Column(length=100000)
    private byte[] bytestream;

    @ApiModelProperty(value = "流程定义id")
    private String processdefinitionid;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("formid_", this.getFormid_());
        map.put("key_", this.getKey_());
        map.put("publishtime", this.getPublishtime());
        map.put("bytestream", this.getBytestream());
        map.put("processdefinitionid", this.getProcessdefinitionid());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Act_dsn_form_modelPK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Act_dsn_form_modelPK pk = (Act_dsn_form_modelPK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}
